package com.yjs.houtai.controller;

import com.yjs.houtai.entity.Message;
import com.yjs.houtai.entity.Room;
import com.yjs.houtai.service.RoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@Api(tags = "房间类型")
@RestController
@RequestMapping("/api/room")
public class RoomController {
    @Resource
    private RoomService roomService;

    @ApiOperation(value="增加房型")
    @PostMapping("/add")
    public Message insertSelective(Room room){
        return roomService.insertSelective(room);
    }

    @ApiOperation(value="删除房型")
    @DeleteMapping("/delete")
    public Message deleteByPrimaryKey(int roomId)
    {
        return roomService.deleteByPrimaryKey(roomId);
    }

    @ApiOperation(value="修改房间")
    @PutMapping("/update")
    public Message  updateByPrimaryKeySelective(Room room){
        return roomService.updateByPrimaryKeySelective(room);
    }

    @ApiOperation(value = "查询房间信息")
    @GetMapping("/select")
    public Message selectByPrimaryKey(int roomId){
        return roomService.selectByPrimaryKey(roomId);
    }

    @ApiOperation(value="查询所有房间")
    @GetMapping("/select1")
    public Message selectAll(){
        return roomService.selectAll();
    }
}
